export const points = Array.from({ length: 24 }, (__, i) => {
  const value = i + 1;
  const label = value < 10 ? `0${value}00` : `${value}00`;
  return {
    value,
    label,
  };
});

export const getColumns = (head) => {
  if (!head) return [];
  const render = (v) => (typeof v === 'number' ? v : '-');
  const autoRowSpan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && v1 === v2;
  return [
    {
      code: 'contractName',
      name: '合约名称',
      width: 340,
      features: { autoRowSpan: true },
      lock: true,
    },
    {
      code: 'contractElectricQuantity',
      name: '合约电量',
      width: 100,
      align: 'center',
      lock: true,
      render,
      features: { autoRowSpan },
    },
    {
      code: 'contractElectricPrice',
      name: '合约电价',
      width: 100,
      align: 'center',
      lock: true,
      render,
      features: { autoRowSpan },
    },
    ...head.map(({ field, name }) => ({
      code: field,
      name,
      width: 100,
      align: 'center',
      render,
    })),
  ];
};
